<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">

          <a-col :md="6" :sm="8">
            <a-form-item label="地址">
              <a-input placeholder="请输入地址" v-model="queryParam.address"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="申请日期">
              <a-input placeholder="请输入申请日期" v-model="queryParam.applyDate"></a-input>
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :md="6" :sm="8">
              <a-form-item label="申请理由">
                <a-input placeholder="请输入申请理由" v-model="queryParam.applyReason"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="审核人账号Id">
                <a-input placeholder="请输入审核人账号Id" v-model="queryParam.auditAccount"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="审核日期">
                <a-input placeholder="请输入审核日期" v-model="queryParam.auditDate"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <!--<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
          <a-icon type="down"/>
        </a-button>
      </a-dropdown>
    </div>

    <!-- table区域-begin -->
    <div>
<!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
        selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>-->

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">

        <span slot="action" slot-scope="text, record">
          <a-popconfirm title="确定通过吗?" v-if="record.auditStatus==0" @confirm="() =>audit(record,1)"><a>通过</a></a-popconfirm>
          <a-divider type="vertical"/>
          <a-popconfirm title="确定拒绝吗?" v-if="record.auditStatus==0" @confirm="() =>audit(record,2)"><a>拒绝</a></a-popconfirm>

          <!--<a-divider type="vertical"/>-->
<!--          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>-->
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <umsPartnerApply-modal ref="modalForm" @ok="modalFormOk"></umsPartnerApply-modal>
  </a-card>
</template>

<script>
  import { httpParamAction } from '@/api/manage'
  import UmsPartnerApplyModal from './modules/UmsPartnerApplyModal'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import {doMian} from '@/api/api'

  export default {
    name: "UmsPartnerApplyList",
    mixins: [JeecgListMixin],
    components: {
      UmsPartnerApplyModal
    },
    data() {
      return {
        description: '合伙人申请管理页面',
        auditForm:{},
        // 表头
        columns: [
          {
            title: '用户Id',
            align: "center",
            dataIndex: 'memberId'
          },

          {
            title: '姓名',
            align: "center",
            dataIndex: 'name'
          },
          {
            title: '微信账号',
            align: "center",
            dataIndex: 'wechatAccount'
          },
          {
            title: '电话',
            align: "center",
            dataIndex: 'mobile'
          },

          {
            title: '省份证',
            align: "center",
            dataIndex: 'pid'
          },
          {
            title: '邮箱',
            align: "center",
            dataIndex: 'email'
          },
          {
            title: '地址',
            align: "center",
            dataIndex: 'address'
          },
          {
            title: '申请日期',
            align: "center",
            dataIndex: 'applyDate'
          },
          {
            title: '申请理由',
            align: "center",
            dataIndex: 'applyReason'
          },
          {
            title: '审核人账号Id',
            align: "center",
            dataIndex: 'auditAccount'
          },
          {
            title: '审核日期',
            align: "center",
            dataIndex: 'auditDate'
          },
          {
            title: '审核状态',
            align: "center",
            dataIndex: 'auditStatus',
            customRender: function (t, r, index) {
              if(t==0){
                return "未审核";
              }else if(t==1){
                return "审核通过";
              }else{
                return "审核不通过";
              }
            }
          },


          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            scopedSlots: {customRender: 'action'},
          }
        ],
        url: {
          list: "/ums/umsPartnerApply/list",
          delete: "/ums/umsPartnerApply/delete",
          deleteBatch: "/ums/umsPartnerApply/deleteBatch",
          exportXlsUrl: "ums/umsPartnerApply/exportXls",
          importExcelUrl: "ums/umsPartnerApply/importExcel",
        },
      }
    },
    computed: {
      importExcelUrl: function () {
        return doMian + `${this.url.importExcelUrl}`;
      }
    },
    methods: {
      audit:function(record,auditResult){
        console.log(record);
        console.log(auditResult);
        this.auditForm.partnerApplyId=record.id;
        this.auditForm.auditResult=auditResult;
        var This=this;
        httpParamAction("/ums/umsPartnerApply/audit", this.auditForm,"put").then((res) => {
          if (res.success) {
            This.loadData();
          }
        });
      }
    }
  }
</script>
<style lang="less" scoped>
  /** Button按钮间距 */
  .ant-btn {
    margin-left: 3px
  }

  .ant-card-body .table-operator {
    margin-bottom: 18px;
  }

  .ant-table-tbody .ant-table-row td {
    padding-top: 15px;
    padding-bottom: 15px;
  }

  .anty-row-operator button {
    margin: 0 5px
  }

  .ant-btn-danger {
    background-color: #ffffff
  }

  .ant-modal-cust-warp {
    height: 100%
  }

  .ant-modal-cust-warp .ant-modal-body {
    height: calc(100% - 110px) !important;
    overflow-y: auto
  }

  .ant-modal-cust-warp .ant-modal-content {
    height: 90% !important;
    overflow-y: hidden
  }
</style>